﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VH.SharePoint.Api.Blogger;
using VH.SharePoint.Api.Queries;
using VH.SharePoint.Api.Repositories.Mock;

namespace VH.SharePoint.Api.Mock
{
    public class MockBlogRepository : BlogRepository
    {
        private static readonly List<Blog> _storage = new List<Blog>();
 
        static MockBlogRepository()
        {
            _storage.Add(new Blog
                {
                    Id = Guid.NewGuid().ToString(),
                    EndPointUrl = "http://blultvh-01:8081/_vti_bin/api/blog.ashx",
                    IsAdmin = true,
                    Name = "Mock Blog",
                    Url = "http://blultvh-01:8081"
                });
        }

        public override IEnumerable<Blog> FindAll()
        {
            return _storage.ToList();
        }

        public override IEnumerable<Blog> FindAll(QueryConstraints<Blog> constraints)
        {
            return _storage.ToList();
        }

        public override Blog Get(string id)
        {
            return _storage.First();
        }

        public override void Create(Blog entity)
        {
            throw new NotSupportedException();
        }

        public override void Update(Blog entity)
        {
            throw new NotSupportedException();
        }

        public override void Delete(Blog entity)
        {
            throw new NotSupportedException();
        }

        public override void ValidateUser(string username, string password)
        {
            
        }

        protected override void Initialize()
        {
            this.Posts = new MockPostRepository();
            this.Categories = new MockCategoryRepository();
            this.Medias = new MockMediaRepository();
        }
    }
}
